<?php
$host='localhost';
$user_name='root';
$password='helloworld';
session_start();
$conn=mysqli_connect('localhost','root','123456','zb');
if(!$conn)
{
    die('数据库连接失败：'.mysqli_error());

}

mysqli_select_db($conn,'zb');
if($_SESSION['bool']==1)
{
    $number=$_POST['number'];
    $name=$_POST['name'];
    $offer=$_POST['offer'];
    $company=$_POST['company'];
    $offerstate=$_POST['offerstate'];
    $homeland=$_POST['homeland'];
    $homestate=$_POST['homestate'];
    $homefuture=$_POST['homefuture'];
    $filefuture=$_POST['filefuture'];
    $sql="update class set 学号='".$number."',    姓名='".$name."',已签约单位='".$offer."',实习单位='".$company."',意向='".$offerstate."',生源地='".$homeland."',户口状态='".$homestate."',户口意向='".$homefuture."',档案意向='".$filefuture."',修改时间=NOW()";
    $result=mysqli_query($conn,$sql) OR die("<br/>ERROR:<b>".mysqli_error()."</b><br/>SQL:".$sql);
}

$number=$_POST['number'];
$sql="select * from class where 学号='$number'";
$result=mysqli_query($conn,$sql) OR die("<br/>ERROR:<b>".mysqli_error()."</b><br/>SQL:".$sql);
$_SESSION['num']=$number;
//upate!!!!!


$sql="update class set 修改时间=NOW()";
mysqli_query($conn,$sql) OR die("<br/>ERROR:<b>".mysqli_error()."</b><br/>SQL:".$sql);


mysqli_close($conn);
$row=mysqli_fetch_array($result,MYSQLI_ASSOC);

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><?php  echo $number ;?></title>

    <script language="javascript">
        function confirm()
        {
            alert("确认信息成功！")
        }
    </script>



</head>
<body>
<b>您的信息</b>
<form name="form" method="post" action="PageUpdate.php">
    <table width="25%" border="0" cellpadding="0" cellspacing="2" >
        <tr>
            <td width="40%" height="29">学号：</td>
            <td width="60%" ><?php echo $row['学号']; ?></td>
        </tr>
        <tr>
            <td width="40%" height="29">姓名：</td>
            <td width="60%"><?php echo $row['姓名']; ?></td>
        </tr>

        <tr>
            <td width="40%" height="29">生源地：<br/></td>
            <td width="60%"><?php echo $row['生源地']; ?></td>
        </tr>


        <tr>
            <td width="40%" height="29">已签约单位：</td>
            <td width="60%"><?php echo $row['已签约单位']; ?></td>
        </tr>
        <tr>
            <td width="40%" height="29">实习单位：</td>
            <td width="60%"><?php echo $row['实习单位']; ?></td>
        </tr>
        <tr>
            <td height="25">有无签约意向：</td>
            <td>
                <?php echo $row['意向']; ?>
            </td>
        </tr>


        <tr>
            <td height="25">户口状态：</td>
            <td>
                <?php echo $row['户口状态']; ?>
            </td>
        </tr>
        <tr>
            <td height="25">毕业后户口意向：</td>
            <td>
                <?php echo $row['户口意向']; ?>
            </td>
        </tr>
        <tr>
            <td height="25">毕业后档案意向：</td>
            <td>
                <?php echo $row['档案意向']; ?>
            </td>
        </tr>

        <tr>
            <td height="25">上次登录时间：</td>
            <td>
                <?php echo $row['修改时间']; ?>
            </td>
        </tr>


        <tr>

            <td height="1">
                <input  type="button" name="Submit" value="确认信息"  onclick="confirm()"/></td>
            <td height="1">
                <input type="submit" name="Submit" value="修改信息" /></td>

            <td> </td>
        </tr>
    </table>

    <a href="PageAll.php">显示全部信息</a>
</form>
</body>
</html>